<%@ page language="java" import="reg.domain.*,java.util.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<title>Nuevas Noticias</title>
	<link href="estilo.css" rel="stylesheet" type="text/css" />
</head>


<body>
<br><br><br>
<div id="main">

<div id="header">
	<div id="logo">
	<a href="index.jsp">Regulacion Informatica</a>
	</div>
</div>

<div id="content">

<div id="left">
		<table cellSpacing="1" cellPadding="6" width="770" align="center" border="0">
			<tr valign="middle" align="center">
				<td colspan="6"><b>Noticias nuevas desde <%= session.getAttribute("session.ultimoLogin") %></b></td>
			</tr>
			<tr valign="middle" align="center" id="cabecera">
				<td>Titulo</td>
				<td>Contenido</td>
				<td>Fecha</td>
			</tr>
			<%
				Usuario u = UserManager.getInstance(session.getAttribute("session.user").toString()).getUsuario();
				List<Noticia> noticias = NoticiaManager.getInstance().getNoticiasDesde(u.getUltimoLogin());
				
				Comparator<Noticia> cmp = new Comparator<Noticia>(){
					public int compare(Noticia n1, Noticia n2){
						return n1.getFecha().compareTo(n2.getFecha());
					}
				};
				
				Collections.sort(noticias, cmp);
				
				for (Noticia n : noticias) {
					%>
						<tr align="center" ">
							<td><%=n.getTitulo()%></td>
							<td> <%=n.getContenido()%> </td>
							<td> <%=n.getFecha()%> </td>
						</tr>
					<%
						}
					%>
		</table>
	</div>	
	
	
	
	
</div>

<div id="down">
	<div id="footer">
 		 <p>ISG3 Curso 2010 - 2011 </p>
 	 </div>
 </div>


</div>

</body>
</html>